<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="/template.xhtml">
		<ui:define name="content">
			<h:form id="formLs">
				<p:panel styleClass="layout_2_L" id="pn_left">
					<p:accordionPanel>
						<p:ajax event="tabChange"
							listener="#{quanLyLichSuBean.onTabChange}"
							update=":formLs:tblLichDk" />
						<p:tab id="tab1" title="Xem theo ngày">
							<p:calendar mode="inline" value="#{quanLyLichSuBean.date}">
								<p:ajax event="dateSelect"
									listener="#{quanLyLichSuBean.handleDateSelect}"
									update=":formLs:tblLichDk" />
							</p:calendar>
						</p:tab>
						<p:tab id="tab2" title="Xem theo tuần">
							<p:calendar mode="inline" value="#{quanLyLichSuBean.fromDate}">
								<p:ajax event="dateSelect"
									listener="#{quanLyLichSuBean.handleWeekSelect}"
									update=":formLs:tblLichDk" />
							</p:calendar>
						</p:tab>
						<p:tab id="tab3" title="Xem theo tháng">
							<p:selectOneMenu value="#{quanLyLichSuBean.thangSelected}">
								<f:selectItems value="#{quanLyLichSuBean.thangList}" var="thang"
									itemLabel="Tháng #{thang}" itemValue="#{thang}" />
								<p:ajax event="valueChange" update=":formLs:tblLichDk"
									listener="#{quanLyLichSuBean.getListFromMonth}" />
							</p:selectOneMenu>
							<p:selectOneMenu value="#{quanLyLichSuBean.namSelected}">
								<f:selectItems value="#{quanLyLichSuBean.namList}" var="nam"
									itemValue="#{nam}" />
								<p:ajax event="valueChange" update=":formLs:tblLichDk"
									listener="#{quanLyLichSuBean.getListFromMonth}" />
							</p:selectOneMenu>
						</p:tab>
						<p:tab id="tab4" title="Xem theo năm">
							<p:selectOneMenu value="#{quanLyLichSuBean.namSelected2}">
								<f:selectItems value="#{quanLyLichSuBean.namList}" var="nam"
									itemValue="#{nam}" />
								<p:ajax event="valueChange" update=":formLs:tblLichDk"
									listener="#{quanLyLichSuBean.getListFromYear}" />
							</p:selectOneMenu>
						</p:tab>
						<p:tab id="tab5" title="Theo môn học">
							<p:inputText value="#{quanLyLichSuBean.strMonHoc}" />
							<p:commandButton icon="ui-icon-search"
								actionListener="#{quanLyLichSuBean.getListFromMonHoc}"
								update=":formLs:tblLichDk" />
						</p:tab>
					</p:accordionPanel>
				</p:panel>
				<p:panel styleClass="layout_2_R" id="pn_right">
				<p:commandButton actionListener="#{quanLyLichSuBean.hienThiDangKyHuy}"
						value="Hiển thị đăng ký đã hủy" update="formLs:tblLichDk" icon="ui-icon-note"/>
				<p:commandButton actionListener="#{quanLyLichSuBean.export}"
						value="Xuất báo cáo" ajax="false" icon="ui-icon-print"/>
					<p:dataTable id="tblLichDk" var="lichDk"
						value="#{quanLyLichSuBean.lichDangKyList}" rowIndexVar="rowIndex"
						paginator="true" rows="15"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="10,15,20" paginatorPosition="bottom">
						<f:facet name="header">
							<h:outputText value=" Thông tin đăng ký phòng máy " />
							<h:outputText id="ngayHienThi"
								value="#{quanLyLichSuBean.ngayHienThi}" styleClass="blue" />
						</f:facet>
						<p:column headerText="STT" styleClass="textCenter">
							<h:outputText value="#{rowIndex+1}" />
						</p:column>
						<p:column headerText="Phòng" styleClass="textCenter">
							<h:outputText value="#{lichDk.tenPhongMay}" />
						</p:column>
						<p:column headerText="Tiết" styleClass="textCenter">
							<h:outputText value="#{lichDk.moTaTietHoc}" />
						</p:column>
						<p:column headerText="Ngày" styleClass="textCenter">
							<h:outputText value="#{lichDk.ngayDat}">
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:column>
						<p:column headerText="Tiêu đề">
							<h:outputText value="#{lichDk.tieuDe}" />
						</p:column>
						<p:column headerText="Mô tả">
							<h:outputText value="#{lichDk.moTa}" />
						</p:column>
						<p:column headerText="Yêu cầu">
							<h:outputText value="#{lichDk.yeuCau}" />
						</p:column>
						<p:column headerText="Lý do hủy">
							<h:outputText value="#{lichDk.lyDoHuy}" />
						</p:column>
						<p:column headerText="Trạng thái" styleClass="textCenter">
							<h:outputText
								value="#{lichDangKyBean.convertStatus(lichDk.status)}" />
						</p:column>
					</p:dataTable>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>